package com.yiwangqingshui.spi;


import com.yiwangqingshui.MySpi;

import java.util.Iterator;
import java.util.ServiceLoader;

/**
 * @author smc
 * @date 2019-02-21 13:40
 * @since
 **/
public class DemoMainOne {

    public static void main(String[] args) {

        ServiceLoader<MySpi>  mySpis = ServiceLoader.load(MySpi.class);

        Iterator<MySpi> iterator =  mySpis.iterator();

        while (iterator.hasNext()){
            MySpi mySpi = iterator.next();
            System.out.println("myspi: "+ mySpi.say("helloworld"));
        }

    }
}
